using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Practices.ServiceLocation;
using NHibernate;
using ThunderJob.Domain.PersistenceInterfaces;

namespace ThunderJob.Persistence.Repositories
{
    public class Repository<T> : IRepository<T>
    {
        protected ISession Session
        {
            get { return NHibernateSession.Current; }
        }

        public T Obtener(int id)
        {
            return Session.Get<T>(id);
        }

        public void Eliminar(T entity)
        {
            Session.Delete(entity);
        }

        public void Agregar(T entity)
        {
            Session.Save(entity);
        }
    }
}